package org.xiaoyu.client;

import com.xiaoyu.stereotype.Component;
import org.xiaoyu.api.HappyService;
import org.xiaoyu.api.HelloService;
import org.xiaoyu.rpc.IsRpcService;
import org.xiaoyu.rpc.common.annotations.RpcReference;

/**
 * Created By Have
 * 2021/7/13 18:32
 */
@Component
public class JustForTestController {

    @RpcReference(serviceName = "happy", group = "public", version = "1.0", interfaceClass = HappyService.class, path = "/happy")
    public HappyService happyService;

    @RpcReference(serviceName = "hello", group = "public", version = "1.0", interfaceClass = HelloService.class, path = "/hello", isAsync = true)
    public HelloService helloService;

    @IsRpcService
    public void sayHappy() {
        String s = happyService.sayHappy();
        System.out.println(s);
    }

    @IsRpcService
    public void sayHello() {
        Object s = helloService.sayHello();
        System.out.println(s);
    }

    @IsRpcService
    public void sayHey() {
        String hey = helloService.sayHey();
        System.out.println(hey);
    }

    @IsRpcService
    public void sayFine() {
        String fine = happyService.sayFine();
        System.out.println(fine);
    }
}
